<?php

require_once 'config.inc';
require_once('_db.inc');
require_once('_ui.inc');
require_once '_customer.inc';
// Create a database connection
$conn = db_connect(CUSTOMER_DB_USER, CUSTOMER_DB_PASSWORD);

 ui_print_header('Customer - Reveal Necessary ID strings');

 $moneyOrders = db_do_query($conn,'SELECT * FROM mo_detail_customer where BATCH=' .$_POST['batch']. ' and mo_n<>' .$_POST['chosen']);
 
 echo <<<END

	<form name="form1" method="post" action="2R_6_BankSignOrCatchCheat.php">
	<table width="800" border="1" cellspacing="1" cellpadding="3" align=center>
	<tr><td colspan=3 align=center>ID String List
				<input type="hidden" name="batch" value="$_POST[batch]">
			<input type='hidden' name='chosen' value="$_POST[chosen]">
			<input type='hidden' name='unblindedMO' value="$_POST[unblindedMO]">
	</td></tr>
	
END;
foreach ($moneyOrders as $MO){
	echo "<tr><td colspan=3 align=center class=Lhead>ID Strings for #$MO[MO_N] Money Order</td></tr>";
    $ID_strings = db_do_query($conn,"SELECT * FROM mo_idstrings_customer where uniqueness_string='" .$MO[UNIQUENESS_STRING] ."'");
	foreach ($ID_strings as $ID){
	  //unblind money order
		echo "<tr><td>" .$ID['IDSTRING_N'] .".</td>";
		echo "<td><input type='text' size='50' name='IDs[$MO[MO_N]][" .$ID['IDSTRING_N'] ."][0]' value='". $ID['L_ID_STRING'] ."'></td>";
		echo "<td><input type='text' size='100' name='IDs[$MO[MO_N]][" .$ID['IDSTRING_N'] ."][1]' value='". $ID['R_ID_STRING'] ."'></td>";
		echo "</tr>";
		//
	}
}
echo <<<END
			
			<tr>
			<td colspan=3 align=center>
			<input type="submit" name="reveal" value="Reveal ID strings to Bank"></td>
			</tr>
			</table>
			</form>
END;
ui_print_footer(date('Y-m-d H:i:s'));
oci_close($conn);
?>